
import { getXlcsQueList } from '@/api/index/index'
export default{
	data(){
		return{
			queList:[]
		}
	},
	methods:{
		loadTestQueList(field,needJumpFlag,logId,cpTit){
			getXlcsQueList(field).then(res=>{
				this.queList = res.data.datas.queList;
				for(let i in this.queList){
					this.queList[i].title = this.queList[i].title.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, p1)=>{
					   return `<img src='${this.gzcpUrl + '/' + p1}' />`
					})
					if(this.queList[i].title.indexOf('<p>') != -1){
						this.queList[i].htmlFlag = true;
					}else{
						this.queList[i].htmlFlag = false;
					}
					this.queList[i].currAns = '';
					this.queList[i].labelVal = '';
					this.queList[i].timeStamp = 0;
					this.queList[i].optIndex = -1;
					this.queList[i].order = '';
				} 
				uni.setStorageSync('queList',this.queList);
				if(needJumpFlag){
					uni.navigateTo({
						url:'/pages/subIndex/cpQue/cpQue?fromPage=gyDetPage&gyLogId=' + logId + '&cpTit=' + cpTit
					})
				}
			}).catch(err=>{
				uni.removeStorageSync('userIdZz');
			});
		}
	}
}